package SSF.OS.WWW;

/**
 * httpRequest.java
 * Created: Wed Nov 24 1999 ato
 * @version 0.1
 */
public class httpRequest {

  /************************ Variables ***************************/

  /** request_type: GET a page URI */
  public static final byte PAGE = 1;    // first request to server

  /** request_type: GET an inlined object URI */
  public static final byte OBJECT = 2;  // subsequent requests to server

  /** HTTP connection behavior control:
   *  HTTP 1.0: separate TCP connection for each request-response cycle,
   *  each request_type is or-ed with CLOSE - server to close connection
   *  after completing response.
   *  HTTP 1.1: one persistent TCP connection for client-server session,
   *  only the last-in-session request_type is or-ed with CLOSE.
   */
  public static final byte CLOSE = 4;   // signal to server to close tcp
                                        // after completing response
  /** type of this request */
  public byte requestType;

  /** payload object size (in bytes) if any included in the request */
  public int objSize;                   // currently not used

  /************************* Constructors ************************/

  public httpRequest() {}

  public httpRequest(byte request_type) {
    requestType = request_type;
  }
  
  /************************ Class Methods ***********************/

  /** to print the request message*/
  public String toString() {
    String str = " ";
    if((requestType & PAGE) == PAGE)
      str = str + "PAGE ";
    if((requestType & OBJECT) == OBJECT)
      str = str + "OBJECT ";
    if((requestType & CLOSE) == CLOSE)
      str = str + "CLOSE ";
    if(str != " ")
      return " [httpRequest:" + str + "]";
    else
      return " [httpRequest: UNKNOWN REQUEST]";
  }
}
